package com.ruoyi.common.exception.base;

/**
 * @Desc: 公共异常处理
 * @Author LuoYong
 * @Date 2022/1/8 17:56
 */
public class CommonException extends RuntimeException {

    public CommonException() {
        super();
    }

    private static final long serialVersionUID = 1L;

    private int code;

    private String message;

    private Throwable throwable;

    public CommonException(int code) {
        this.code = code;
    }

    public CommonException(String message) {
        this.code = 500;
        this.message = message;
    }

    public CommonException(String message, Throwable e) {
        this.code = 500;
        this.message = message;
        this.throwable = e;
    }

    //
    public CommonException(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public CommonException(int code, String message, Throwable e) {
        this.code = code;
        this.message = message;
        this.throwable = e;
    }


    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }


}
